package com.xinwei.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinwei.dao.ClassDao;
import com.xinwei.excpetion.ManagerException;
import com.xinwei.excpetion.ManagerExceptionEnmu;
import com.xinwei.service.ClassService;
import com.xinwei.vo.ClassVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassServiceImpl extends ServiceImpl<ClassDao, Class> implements ClassService {

    @Autowired
    private ClassDao classDao;

    @Override
    public List<ClassVO> getClassList(Integer grade, Integer professionalId) {
        List<ClassVO> classList = classDao.getClassList(grade, professionalId);
        if (null == classList || classList.size() == 0){
            throw new ManagerException(ManagerExceptionEnmu.NO_CLASS_INFO);
        }
        return classList;
    }
}
